package 牛客_面试必刷.Month07.day10;

public class 二叉树的最大深度 {
    public int maxDepth (TreeNode root) {
        // write code here
        int height = solve(root);
        return height;
    }

    public int solve(TreeNode root){
        if(root == null) return 0;
        return Math.max(solve(root.left)+1,solve(root.right)+1);
    }

}
